package com.qdlc.p2p.dal.model;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.BeanUtils;

import com.qdlc.p2p.common.util.PropertiesUtil;
import com.qdlc.p2p.common.util.StringUtil;
import com.qdlc.p2p.dal.dto.RateInterest;

/**
 * 用户获取到加息券的model
 * @author wjx
 * @version 2.0
 * @date 2015年4月29日 下午6:10:45
 */
public class RateInterestModel extends RateInterest {
	

	private Date startAddTime;//查询添加起始时间
	
	private Date endAddTime; //查询添加结束时间
	
	/**
	 * 可用
	 */
	public  static final int RATE_STATUS_AVAIL=0;
	
	/**
	 * 已用
	 */
	public  static final int RATE_STATUS_USE=1;
	
	/**
	 * 过期
	 */
	public  static final int RATE_STATUS_OVERD=2;
	
	/**
	 * 作废
	 */
	public static final int RATE_STATUS_FAIL = 3;
	
	/** 当前页码 */
	private int page = 1;

	/** 每页数据条数 */
	private int rows = 5;
	
	private String userName;  //用户名
	
	private String ruleName;  //规则名称
	
	private String searchName; //查询使用的规则名称
	
	private int payWay; //获取方式
	
	/**
	 * App 参数校验
	 * @return
	 */
	public Map<String,Object> validParams(){
		if(StringUtil.isBlank(getPage())){
			Map<String,Object> data = new HashMap<String,Object>();
			data.put("resCode", "0");
			data.put("resMsg", PropertiesUtil.getValue(""));
			return data;
		}
		if(StringUtil.isBlank(getStatus()) || getStatus() < 0){
			Map<String,Object> data = new HashMap<String,Object>();
			data.put("resCode", "1");
			data.put("resMsg", PropertiesUtil.getValue(""));
			return data;
		}
		return null;
	}
	public static  RateInterestModel instance(RateInterest rateInterest){
		RateInterestModel model = new RateInterestModel();
		BeanUtils.copyProperties(rateInterest, model);
		return model;
	}
	
	public RateInterest property(){
		RateInterest rateInterest = new RateInterest();
		BeanUtils.copyProperties(this, rateInterest);
		return rateInterest;
	}
	

	public Date getStartAddTime() {
		return startAddTime;
	}

	public void setStartAddTime(Date startAddTime) {
		this.startAddTime = startAddTime;
	}

	public Date getEndAddTime() {
		return endAddTime;
	}

	public void setEndAddTime(Date endAddTime) {
		this.endAddTime = endAddTime;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getRows() {
		return rows;
	}

	public void setRows(int rows) {
		this.rows = rows;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getRuleName() {
		return ruleName;
	}

	public void setRuleName(String ruleName) {
		this.ruleName = ruleName;
	}

	public int getPayWay() {
		return payWay;
	}

	public void setPayWay(int payWay) {
		this.payWay = payWay;
	}

	public String getSearchName() {
		return searchName;
	}

	public void setSearchName(String searchName) {
		this.searchName = searchName;
	}
	
	
	
	
	

}
